package cn.xit.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/user")
public class UserController {

    @GetMapping("/")
    public String index(){
        return "index";

    }
    @GetMapping("/toLogin")
    public String toLogin(){
        return "login";

    }

    @PostMapping("/login")
    public String login(@RequestParam("username")String username, @RequestParam("password")String password, Model model){

        model.addAttribute("username",username);
        model.addAttribute("password",password);

        return "success";

    }
}
